package com.codeoss.framework.data.metadata;

import java.util.ArrayList;
import java.util.List;

/**
 * 查询条件
 * @author nethaoke
 * 2020-06-03
 */
public class Query{ 
	private List<Expression> expressionList=new ArrayList<Expression>(); 
	private int limit;
	private int page=1;
	private List<String> selectColumnList=new ArrayList<String>();
	private List<Order> orderList=new ArrayList<Order>();
    public Query add(Expression expression){
    	expressionList.add(expression);
    	return this;
    }
    
    public Query addOrder(Order order){
    	orderList.add(order);
    	return this;
    }
    
	public int getLimit() {
		return limit;
	}

	public Query setLimit(int limit) {
		this.limit = limit;
		return this;
	}

	public int getPage() {
		return page;
	}

	public Query setPage(int page) {
		this.page = page;
		return this;
	}
	
	public boolean isPaginationQuery(){
		return limit>0;
	}
	
	public List<Order> getOrderList(){
		return orderList;
	}
	
	public List<Expression> getExpressionList(){
		return expressionList;
	}
	
	public List<String> getSelectColumnList() {
		return selectColumnList;
	}

	public void setSelectColumnList(List<String> selectColumnList) {
		this.selectColumnList = selectColumnList;
	}

	public void addSelectColumn(String column) {
		selectColumnList.add(column);
	}
}
